import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const device = "./views/" + (document.body.clientWidth <= 750 ? "mobile" : "pc");

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/login"
    },
    {
        path: '/visitRecord',
        name: 'visitRecord',
        component: () => import(`./views/pc/visitRecord.vue`)
    },
    {
        path: '/accessControlVideo',
        name: 'accessControlVideo',
        component: () => import(`./views/pc/accessControlVideo.vue`)
    },
    {
        path: '/login',
        name: 'login',
        component: () => import(`${device}/login.vue`)
    },
    {
        path: '/nearlySevenDays',
        name: 'nearlySevenDays',
        component: () => import(`${device}/nearlySevenDays.vue`)
    },
    {
        path: '/userManagement',
        name: 'userManagement',
        component: () => import(`${device}/userManagement.vue`)
    },
    {
        path: "/notFound",
        name: "notFound",
        component: () => import(`./views/notFound.vue`),
    },
    {
        path: "/*",
        redirect: "/notFound"
    }
]



export default createRouter({ history: createWebHashHistory(), routes })
